約 4,469,165 件
https://w.atwiki.jp/beatlesong/pages/16.html
Help| HELP! - 4人はアイドル ザ・ビートルズ EMIミュージック・ジャパン 1998-03-11 売り上げランキング 2028 おすすめ平均 Amazonで詳しく見る by G-Tools Side A Help! (Lennon - McCartney) The Night Before (Lennon - McCartney) You ve Got To Hide Your Love Away (Lennon - McCartney) I Need You (Harrison) Another Girl (Lennon - McCartney) You re Going To Lose That Girl (Lennon - McCartney) Ticket To Ride (Lennon - McCartney) Side B Act Naturally (Morrison - Russell) It s Only Love (Lennon - McCartney) You Like Me Too Much (Harrison) Tell Me What You See (Lennon - McCartney) I ve Just Seen A Face (Lennon - McCartney) Yesterday (Lennon - McCartney) Dizzy Miss Lizzie (Williams) 名前 コメント
https://w.atwiki.jp/remastercd/pages/49.html
HELP!/4人はアイドル (1964) 1. ヘルプ! - Help! 2. ザ・ナイト・ビフォア - The Night Before 3. 悲しみはぶっとばせ(ユーヴ・ゴット・トゥ・ハイド・ユア・ラヴ・アウェイ) - You ve Got To Hide Your Love Away 4. アイ・ニード・ユー - I Need You 5. アナザー・ガール - Another Girl 6. 恋のアドバイス(ユーアー・ゴイング・トゥ・ルーズ・ザット・ガール) - You re Going To Lose That Girl 7. 涙の乗車券(ティケット・トゥ・ライド) - Ticket To Ride 8. アクト・ナチュラリー - Act Naturally 9. イッツ・オンリー・ラヴ - It s Only Love 10. ユー・ライク・ミー・トゥ・マッチ - You Like Me Too Much 11. テル・ミー・ホワット・ユー・シー - Tell Me What You See 12. 夢の人(アイヴ・ジャスト・シーン・ア・フェイス) - I ve Just Seen A Face 13. イエスタデイ - Yesterday 14. ディジー・ミス・リジー - Dizzy Miss Lizzie HELP!/4人はアイドル (198) テーブルは 縦棒で くぎります 初CD化 HELP!/ヘルプ! (2009) TOCP-71005 2009.9.9 ¥2,600 2009年度最新デジタル・リマスター使用 初のステレオCD化 ドキュメンタリー映像(CD-EXTRA)
https://w.atwiki.jp/ltts/pages/36.html
version6.6にてscript(Lua Scripting)に対応しました この機能によりある程度のオートメーション化に役立つと思われますが現時点でサンプルが少なく(2016/02/21現在11件) 初心者は手が出しにくい状態になっています どなたかわかる方は記述をお願いいたします。 参考ページ イントロダクション API サンプル(BlackJack) (参考アドレス) http //steamcommunity.com/sharedfiles/filedetails/?id=714904631 Introduction 導入 This guide is designed for those with limited experience scripting with LUA. このガイドはLUAスクリプトに限って作成されています。(それ以外の言語では対応していません) It will review the basics of how to format code, 基本的なフォーマットコードの見方は the building blocks for you to base your code on and provide some examples. いろいろな例をもって説明します It is designed to be hands-on, so you should have Tabletop Simulator open and your LUA editor up to follow along. 実践ながらLUAエディターを使ってみましょう Before The First Keystroke はじめに First, I would highly recommend getting Atom if you intend to script in Tabletop Simulator. はじめに、スクリプトをいじるために、「Atom」の知識が必要です It knows what functions can be used and will import/export code into/out of TS. 「TS」のインポート、エクスポートを知るために下のアドレスを確認しましょう。Instructions on installation and setup of Atom[berserk-games.com] ↑「Atom」の説明アドレス Next you should 次に下のアドレスをブックマークしておきましょう。 bookmark the documentation knowledge base[berserk-games.com]. You will be referencing this site often once you start to write your own scripts. スクリプト作っていくうちにこのサイトが役にたつでしょう。 Its where you go to find Tabletop Simulator specific functions and how they work. ここにはTTSでのスクリプトがどのように動いているかわかります。 You will most often use the API and Objects pages, at least in my experience. 特に「API」と「Object」のページはよく使うでしょう。 Setting Up 準備 When you save your scripts in Tabletop, あなたのスクリプトをTTSで保存するとき it will use your most recent save and then load the script into it. 最新のセーブ、スクリプトがはいったものを使うこと So for any script you intend to write, you will need to do the following スクリプトを書き足す時には下の事に注意しましょう。 Set up the table the way you want it. テーブルを立てる Save the table. テーブルをセーブする(上の「Menu」から Load the table. テーブルをロードする For this exercise, take a blank table and spawn two objects (I used a square block and rectangle block) as well as a red checker. たとえば右の画像みたいに赤と青のブロックと 赤い確認用コインがあります。 Remember to save/load then open up the scripting in Atom Atomでセーブする前にセーブ ロードすること、 or go to Host Scripting in Tabletop Simulator to begin. ホストとしてTTSをはじめることを覚えておいてください 1) Global.lua ファイルの編集 Global.lua is the scripting which is a part of the save file. 「Global.lua」はセーブデータのスクリプトの一部です。 It is where we will be working for most of this tutorial. 練習の最初としてここをやります。 On a new save, it always starts with some text saved into the editor. 新しいセーブをテキストエディターで開きましょう。 Just delete it, we will not be using it. いったん閉じましょう。これは今回使いません。 It is also possible to write scripts and attach them to objects instead of Global. スクリプトを書くこともできますし、グローバルデータの代わりにも使えます。 That way if you save and object it will save its LUA right along with it. セーブすると自動的にLUAデータとして保存されていきます。 You can perform most functions using either Global or Item scripts but we will be working in Global. このデータは「Global」データか「Item」データとして使うことができますが、 ここでは「Global」データとして使っていきます。 2) Functions 機能 Functions[berserk-games.com] are what trigger groups of code. 「Functions」はコードの1グループとして機能します。 Some of them are built into the scripting system (ex. onload()) while others can be created by the user.Every function will start with the word function and end with the word end. 右の図でいうピンク文字の「function」から「end」までが1グループとなります。 A common function built into Tabletop Simulator is onload(). This function triggers every time the script is loaded (like if Undo/Redo is pressed). TTSでよく使う「onload()」はゲームの読み込み時に機能します。 So let us get started by using it to activate a function we will create. Functions should start with a lowercase letter, and cannot contain spaces. We ll use exampleFunction. 「Functions」の機能は「小文字で表記」し、「スペースを含めてはいけません」 function onload() exampleFunction() end Now our script, when it loads, will try to run a function named exampleFunction. But we haven t written one yet! So now we will create our own function, right after the onload function has ended. 上のままじゃ特に何もおきません。 function exampleFunction() print( Hello, World. ) end The command of print() is also a function. But instead of triggering a section of code in LUA, it activates programming inside of Tabletop Simulator to produce a desired effect. In this case, printing a message to the host of the game, in chat.The message is called a string, and is always surrounded by quotes to indicate that. A string is a series of characters. (Ex This is a string. or So is this! )When you save and upload your script, it should now print Hello, World. to chat. 【print( 表示させたい文字 )】 :「表示させたい文字」がチャット欄に表示されます。 このメッセージは「string」とよばれます Extra Credit When you create your own function, you can also pass variables along with it for the function to use. Another way to write our starting exercise would be 応用編:下の通りにやってみましょう。 function onload() exampleFunction( Hello, World. ) end function exampleFunction(passedString) print(passedString) end We created a variable to represent the string (passedString) and then printed what was contained in that variable. 「passedString」は? 3) Objects オブジェクト Objects[berserk-games.com] are the physical entities that exist within tabletop. In our example, our objects currently are two blocks and a checker (what a terrible game we are making). Using scripting, we can manipulate objects, move them, add buttons to them or perform other various actions. We re starting our Global.lua over fresh. Erase all text in it. 「オブジェクト」はTTSでは物理的なものになります。 たとえば、さっきつくった赤と青とコインがあるだけの謎のゲーム。 これにスクリプトを使って追加したボタンで動きをあたえてみましょう Global.luaを開いて全てのテキストを一度けしましょう。 GUIDs ガイド To affect and object, first we must identify it in LUA. There are several ways to do this, such as identifying items being picked up or put down by players, finding objects inside of a scripting zone and more. We will be identifying these objects by their GUID. まず「プレイヤーがそのオブジェクト」を「持っている」か「持っていないか」を見極めることが大切です。 そのために「GUID」の機能を使いましょう。 A GUID is a unique identifier which each spawned item in TS will have. Even 2 of the same item will have different GUIDs. To locate an object s GUID, right click on it and go to Scripting. If you click on its GUID there, it will copy it to your clipboard. A GUID is always a string, so remember strings are always in quotes. Lets create some variables with the GUIDs of our objects. REMEMBER Your GUIDs will be different than mine. object1_GUID = 195868 object2_GUID = 333365 checker_GUID = 7dc60d TTS上で作られたオブジェクト毎に上のような「GUID」のコードが設定されている。(見た目が同じものや、コピーしたものでも違うGUIDになる) このGUIDはオブジェクトを右クリックしたとき、上記のように、チャット欄に出てくる (上のGUIDのコードはあなたが実際に試したものとは違う数字になるでしょう) Defining Objects オブジェクトの定義 Then, using onload so this happens when the script is loaded, we will make variables to represent our objects. All of these variable names we ve been making must start with a lower case letter and not contain spaces, but other than that you are fairly free to make up variable names yourself. You want to make it clear what it represents. I will be using object1, object2 and checker to represent my objects. The function we will use to identify will be getObjectFromGUID(string). We place the GUID in the spot for the string. 次に、onloadを使用して、スクリプトがロードされたときに、オブジェクトを表す変数を作成します。 これらの変数名はすべて小文字で始まり、空白を含まないようにしなければなりませんが、 変数名を自分で作ることはかなり自由です。 今回は、何を表しているかを明確にしたいので、オブジェクトを表すためにobject1、object2、checkerを使用します。 識別に使用する関数は「getObjectFromGUID(string)」です。 GUIDを文字列の場所に配置します。 function onload() object1 = getObjectFromGUID(object1_GUID) object2 = getObjectFromGUID(object2_GUID) checker = getObjectFromGUID(checker_GUID) end Manipulating Objects オブジェクトの名前設定 Now we need to manipulate these objects somehow. We will give them a name. In onload(), after we defined our objects, we will use the function of setName(string). Notice that setName, like other object functions, must be tied to an object. Otherwise the script will not understand what object s name we want to change. The string in setName will be what we set the name to. これらのオブジェクトを何らかの形で操作する必要があります。 そのため、これらに名前をつけます。 onload()では、オブジェクトを定義した後、setName(string)の関数を使用します。 setNameは、他のオブジェクト関数と同様に、オブジェクトに結びつけられなければならないことに注意してください。 それ以外の場合、スクリプトはどのオブジェクトの名前を変更したいのか理解しません。 setNameの文字列は、名前を設定する文字列になります。 object1.setName( Object1 ) object2.setName( Object2 ) checker.setName( That Stupid Checker ) Extra Credit You may be curious as to why we didn t put the object GUIDs directly into getObject (EX object1 = getObjectFromGUID( 195868 ) ). We could have, it would work. This example was to show you that, sometimes, it is more convenient to set a variable early on so you can reference it later. That way, if that variable needs to change (new GUID) you don t have to try to track it down to fix it throughout your code. If you wanted to, for the checker, there is no reason you couldn t write it like 追記:なぜオブジェクトGUIDを直接getObject(EX:object1 = getObjectFromGUID( 195868 ))に入れなかったのか 疑問をもたなかったでしょうか? そのままでもうまくいくでしょう。 この例では、後で参照できるように、変数を早期に設定する方が便利な場合があることを示しています。 そうすれば、その変数を変更する必要がある場合(新しいGUID)、 コード全体で修正するためにそれを追跡する必要はありません。 あなたが途中のチェック用に使うのでなければとめませんが・・・ function onload() getObjectFromGUID( 7dc60d ).setName( That Stupid Checker ) end The reason I do not encourage that for learners is partially an aesthetic choice, and partially for code clarity. You want it to be easy for someone else to understand your code, and once you start doing things more complex than changing the name of an object it can get VERY difficult to see what is going on. It can also make future revisions to your code a chore. 「先に名前の定義を書く」ことで、やりやすくなるでしょう。 4) Buttons ボタン While there are many ways to activate functions, buttons are a convenient way to activate sections of code at the player s choosing. All buttons must be attached to an object, and are created using parameters. The object we want to attach our button to is our checker, and those parameters are found on the Objects page in the Knowledge Base. Many are optional, here they are for reference. 機能を有効にする方法はたくさんありますが、ボタンはプレーヤーがボタンを押したときにスクリプトを起動するわかりやすい機能です。 すべてのボタンはオブジェクトに関連付けする必要があり、パラメータを使用して作成されます。 ボタンを関連付けするオブジェクトはチェッカーであり、これらのパラメータはナレッジベースのObjectsページにあります。 多くはオプションです。ここでは参考にしています。 click_function = String --The name of the function which will activate when this button is pressed. ボタンを押したときに起動します function_owner = Object --Determines where the function that the button activates lives (global or an object s script). ボタンが有効になる機能(グローバルまたはオブジェクトのスクリプト)を決定します。 labels = String --The name on the button. ボタン自身に名前をつけます position = Table --X, Y and Z coordinates for where the button appears, from the center of the object it is attached to. ボタンが表示される場所のX座標、Y座標、Z座標を、オブジェクトが取り付けられているオブジェクトの中心から取得します rotation = Table --Pitch, Roll and Yaw in degrees, relative to the object it is attached to. 投げる勢い、転がりかた、振り方を、添付したオブジェクトを基準にした角度で表します。 width = Number --How wide the button is, relative to the scale of its object. ボタンの広さを設定します height = Number --How tall the button is, relative to the scale of its object. ボタンの高さを設定します font_size = Number --Size of the text on the button, relative to the scale of its object. ボタン上に表示されるフォントのサイズを設定します。 Tables Tables in LUA are collections of entries. You can store most anything inside of a table and reference it later. All tables are indicated by curly brackets {}. You can reference entries in a table by a name or by an index number (what number entry it is, indexes start at 1 in LUA.). We will be creating a table right beneath where we established our GUIDs and then filling it with entries to use with the createButton(table) function. The name we are choosing for our table is button_paramiters LUAのテーブルはエントリの集合です。 ほとんどのものはテーブルの中に格納し、後で参照することができます。 すべてのテーブルは中括弧{}で示されます。 テーブル内のエントリは、名前またはインデックス番号(どの番号エントリか、LUAのインデックスは1から始まります)によって参照できます。 GUIDを作成した場所の直下にテーブルを作成し、createButton(table)関数で使用するエントリを入力します。 テーブル用に選択している名前はbutton_paramitersです。 button_parameters = {} button_parameters.click_function = buttonClicked button_parameters.function_owner = nil button_parameters.label = Press Me button_parameters.position = {0,0.8,0} button_parameters.rotation = {0,0,0} button_parameters.width = 500 button_parameters.height = 500 button_parameters.font_size = 100 Now we have a table with the paramiters listed within it. So lets use the object function to create a button on the checker. Enter this inside of function onload() before its end. 今度は、その中にリストされたパラメータを持つ表があります。 オブジェクト関数を使用してチェッカーにボタンを作成させます。 終了する前にfunction onload()の中でこれを入力してください。 checker.createButton(button_parameters) Check Your Work 動作確認 Save and apply your code. You should now have a button which floats a few inches above your checker. If you don t see it and didn t get an error, try flipping your checker over. It might be upside down so the button is hiding inside the table! If you did flip the checker over, remember to save over your old save with the checker correctly positioned. コードを保存して適用します。 チェッカーの上に数インチ上に浮かぶボタンがあります。 表示されず、エラーが表示されない場合は、チェッカーを裏返しにしてみてください。 それは、ボタンがテーブルの中に隠れているので、逆さまになっているかもしれません! チェッカーを裏返しにした場合は、チェッカーが正しく配置された状態で古いセーブを保存してください。 Add Button Function ボタン追加 Now we need to add the button s function into our code. To test the function out, we ll print ourselves a message. We ll add this user-defined function to the end of our script. 今度はボタンの機能をコードに追加する必要があります。 関数をテストするために、メッセージを表示します。 このユーザー定義関数をスクリプトの最後に追加します。 function buttonClicked() print( Learning is fun. Sort of. ) end After uploading our script, pressing the button should print our message once for each click. スクリプトをアップロードした後、ボタンを押すと、クリックごとにメッセージが1回表示されます。 Click it repeatedly because of course you will. 同じコードを繰り返すので、繰り返しクリックした表記になります EXTRA CREDIT 追記 When you create tables, there are several ways to accomplish it[www.lua.org]. The way used here was to provide visual clarity. However, creating button parameters like this, if you are going to have many buttons, takes up A LOT of space. I prefer to create my tables in such a way that it saves space but doesn t create a run-on line that goes well off the right side of the screen. Using our example, I would have created my parameter table like this テーブルを作成するときに、テーブルを作成するにはいくつかの方法があります[www.lua.org]。 ここで使用される方法は、視覚的な明快さを提供することでした。 しかし、このようなボタンパラメータを作成すると、多くのボタンを使用する場合は、多くのスペース(広さ)が必要になります。 私はスペースを節約するが、画面の右側からうまくいくランオンラインを作成しないような方法でテーブルを作成することを好みます。 私の例を使って、私は次のように私のパラメータテーブルを作成したでしょう: button_parameters = { click_function= buttonClicked , function_owner=nil, label= Press Me , position={0,0.8,0}, rotation={0,0,0}, width=500, height=500, font_size=100 } EXTRA CREDIT This is the perfect point to start playing with different things you can do with objects. Go to the Object page in the Knowledge Database and try stuff. Move the objects, make them switch positions, change their colors, whatever you can think of. これは、オブジェクトで行うことができるさまざまな作業を開始するのに最適なポイントです。 ナレッジデータベースのオブジェクトページに移動して試してみてください。 オブジェクトを動かす、位置を切り替える、色を変える、何でも考えることができます。 EXTRA CREDIT Also, any time you press a button, its click_function triggers with 2 parameters. The first is an object reference, specifically the reference to the object the button is attached to. The second is a color (ex. Blue ) in string format of the color player who pressed the button. また、ボタンを押すたびに、そのclick_functionが2つのパラメータで引用されます。 1つはオブジェクト参照です。具体的には、ボタンがアタッチされているオブジェクトへの参照です。 2番目のボタンは、ボタンを押したカラープレーヤーの文字列形式の色(例: Blue )です。 5) Logic Statements Logic statements[www.lua.org] are generally called if statements . They are used to tell your code what you want it to do in a given situation. When the statement is activated (say, by pressing a button) the logic contained in its statement will only be activated if the condition given is true. They are always formatted as 論理文[www.lua.org]は、一般に「if文」と呼ばれます。 彼らはあなたのコードを与えられた状況で何をしたいのかを伝えるために使われます。 ステートメントがアクティブになると(たとえばボタンを押すことによって)、ステートメントに含まれるロジックは、指定された条件が真である場合にのみアクティブになります。 それらは常に次のようにフォーマットされます。 if CONDITION then --Activates if condition was true end You can also add else to that, so that if the statement is false, something ELSE happens instead. Notice here I added commenting using two minus signs in a row. The engine will ignore anything on a line after --. また、 else を追加することもできます。その結果、文が偽であれば、代わりにELSEが発生します。 ここでは、2つのマイナス記号を連続して使用してコメントを追加しました。 エンジンは〜の後の行の何かを無視します。 if CONDITION then --Activates if condition was true else --Activates if condition was false end What you place in the area I labeled CONDITION in these examples are called relational and conditional operators.[www.tutorialspoint.com] Using them, you can compare many things to eachother. They produce what is called a boolian value (a variable value that is either true or false ). これらの例でCONDITIONというラベルを付けた領域に配置するものは、リレーショナルおよび条件付き演算子と呼ばれます。[www.tutorialspoint.com]これらを使用して、多くのことをお互いに比較できます。 ブーリアン値(「真」または「偽」のいずれかの可変値)を生成します。 Our First Logic Statements We will try a few of these out. Erase the current contents in your buttonClicked() function. Now enter into that function these statements これらのうちのいくつかを試してみましょう。 buttonClicked()関数の現在の内容を消去します。 その関数に次の文を入力します。 if 5 6 then print( 5 is greater than 6 ) end if 6 4 then print( 6 is greater than 5 ) end if 5 == 0 then print( Five is equal to ZERO?! ) else print( No, five isn t equal to zero. ) end When those lines are used and the button pressed, you will see that only the print functions located in the TRUE statement were printed. Also, because 5==0 is a false statement it activated the print function located in the else part of the logic. これらの行が使用され、ボタンが押されると、TRUEステートメントにある印刷機能だけが表示されます。 また、5 == 0は偽の文であるため、ロジックの「else」部分にある印刷機能を有効にしました。 Comparing Variables Once again, erase all of the scripting inside of the buttonClicked() function. We are going to be creating a new variable, then altering it. The new variable will be a bool. Bool values can only be true, false or nil (nil means neither). Bool values are always written in all lower case. First, we will create our variable just beneath our object and checker GUIDs being established. もう一度、buttonClicked()関数内のすべてのスクリプトを消去します。 私たちは新しい変数を作成し、それを変更します。 新しい変数はboolになります。 Boolの値はtrue、false、またはnil(nilはどちらも意味しません)のみです。 ブール値は常にすべての小文字で記述されます。 まず、オブジェクトとチェッカーのGUIDが確立される直前に変数を作成します。 trueOrFalse = true Then, in buttonClicked, we will establish some logic to check if trueOrFalse is, well, true or false. If it is true, we ll print that it was true and switch it over to false. If the button is clicked again, it will print that it was false and switch it to true. 次に、buttonClickedでは、trueOrFalseがtrue、falseまたはfalseであるかどうかを確認するロジックを確立します。 真であれば、それが本当であることを表示し、それを偽に切り替えます。 ボタンを再度クリックすると、falseであることが表示され、trueに切り替えられます。 if trueOrFalse then print( trueOrFalse was true. ) trueOrFalse = false else print( trueOrFalse was false. ) trueOrFalse = true end We could have also written that as if trueOrFalse == true then but that is unnecesary. Remember, the IF statement just needs to be fed True or False. And since trueOrFalse is already one of those, we can skip the operators. 以下のように書くこともできます」trueOrFalseが、その後真==場合は、「それはunnecesaryであるように、その。IF文がちょうどTrueまたはFalseに供給する必要があることを覚えておいてください。trueOrFalseは既にそのうちの一つであるので、私たちは、事業者をスキップすることができます。 6) Loops Loops are sections of code that can run multiple times/continuously when activated only once. These are some of the more complex elements you will use in LUA. They often go hand-in-hand with tables, allowing you to run code on each entry in the table. ループは、1回だけ起動すると複数回/連続して実行できるコードのセクションです。 これらは、LUAで使用するより複雑な要素の一部です。 彼らはしばしばテーブルと手を携えてテーブルの各エントリにコードを実行させます。 Numeric For Loops A numeric for loop[www.lua.org] is one which runs a set number of times. You give it 2 or 3 numbers and a unique variable name (I will use i , which stands for index) and it starts at the first number, then goes until it hits the second number. If a third number is used, it will count by that. So normally it counts up from 1 by 1, but if you put, as a third number, a 2 it would count by 2s. Each number is separated by a comma. Replace the code in your buttonClicked function with this and give it a try. i , the index, will be equal to 1 on the first run, then it will go up by 1, and be equal to 2 and run again, and keep doing that until it hits 10. ループ[www.lua.org]の数値は、設定された回数だけ実行される数値です。 2つまたは3つの数字と一意の変数名(私は i を使用します)は最初の数字から始まり、2番目の数字に当たるまで続きます。 3番目の数字が使用されている場合は、それによってカウントされます。 通常は1から1までカウントアップしますが、3番目の数字として2を入れると2になります。 各番号はコンマで区切られています。 buttonClicked関数のコードをこれに置き換えて試してみてください。 索引「i」は最初の実行では1になり、次に1になり、2に等しくなり、再び実行され、10に達するまでこれを続けます。 for i=1, 10 do print(i) end print( Loop Finished ) What the output is upon pressing the button ボタンを押したときの出力は何ですか? Generic For Loops A generic for loop[www.lua.org] is one which runs through entries in a table. For example, the button_parameter table we created. We would set two variables, one for index and one for value, in the loop and then it would run through each entry in the provided table. For each entry in the table, it would make index equal the name of the variable (Ex position, width, etc) and value equal that values we gave each entry. Add this after your current for loop in buttonClicked. 一般的なforループ[www.lua.org]は、テーブル内のエントリを実行するものです。 たとえば、作成したbutton_parameterテーブルです。 ループ内に2つの変数(インデックス用と1つの値用)を設定し、提供されたテーブルの各エントリを実行します。 テーブル内の各エントリについて、変数の名前(例:位置、幅など)と同じになり、値は各エントリに与えた値と等しくなります。 buttonClickedの現在のforループの後にこれを追加します。 for i, v in pairs(button_parameters) do print(i) end What the output is upon pressing the button ボタンを押したときの出力は何ですか? Break Break[www.lua.org] will end a for loop as soon as it is activated. For instance, if you added to your numeric for loop, just after its print function, the line if i==3 then break end, it would end the loop after it had printed 1, 2, 3. Break [www.lua.org]は、forループがアクティブになるとすぐに終了します。 たとえば、数字のforループに追加した場合、その印刷機能の直後に、i == 3の場合は行末が終了し、1,2,3の場合はループが終了します。 7) Scripting Outside of Global In order to write a script directly into an object, right click that object in game, go to Scripting, and select Lua Editor (if you use Atom, this will open a window in Atom for it). スクリプトをオブジェクトに直接書き込むには、ゲーム内でそのオブジェクトを右クリックし、Scriptingに行き、Lua Editorを選択します(Atomを使用している場合は、Atomのウィンドウが開きます)。 When you write LUA here, it is just like global. Except if you need to reference the object the script is a part of, you simply write self without the quotes, all lower case. So to create a button on itself, you would use self.createButton(table_of_paramiters). ここでLUAを書くと、それはまるでグローバルに似ています。 スクリプトが含まれているオブジェクトを参照する必要がある場合を除いて、引用符なしにすべて小文字の self と書くだけです。 そのため、ボタン自体を作成するには、self.createButton(table_of_paramiters)を使用します。 Closing I hope this introduction to LUA has helped you better understand some of the underlying mechanics of scripting. If not, then I hope you get lost on your way to throttle me. LUAの紹介が、スクリプトの基本的な仕組みの一部を理解するのに役立ちました。 もしそうでなければ、私はあなたが私を抑えるためにあなたの道に迷ってくれることを願っています。 Remember, the Knowledge Base has information on all the functions which are a part of Tabletop Simulator. That, and some basic practice with if/else/then and for loops will let you accomplish most anything you want. Good luck. 知識ベースには、卓上シミュレータの一部であるすべての機能に関する情報があります。 それと、if / else / thenとforループを使ったいくつかの基本的な習慣は、あなたが望むほとんどのものを達成できるようにします。 がんばろう。 Also, if you are on you way to coding, I have started a list of functions to take care of some more complex processes in Lua. You can find it here. また、あなたがコーディングする方法を知っているなら、私はLuaでもっと複雑なプロセスを扱う関数のリストを開始しました。 ここで見つけることができます。
https://w.atwiki.jp/darwinia_jp/pages/66.html
間違いや疑問点がありましたらBBSをご利用ください。 行 項目 原文 本編の対応項目 半角文 6 help_camera_movement Move the camera around using the [KEYFORWARDS], [KEYLEFT], [KEYBACKWARDS] and [KEYRIGHT] keys. You can control the camera s height by scrolling the mouse wheel, or by using the [KEYUP] and [KEYDOWN] keys. 7 help_camera_height If you have a middle mouse button, you can scroll it to change the height of the camera. Or you can use the [KEYUP] and [KEYDOWN] keys to go up and down. 8 help_camera_zoom If you have a middle mouse button, click it to zoom the camera. Or you can press the [KEYZOOM] key. 9 help_camera_movefast You can make the camera move faster by holding down the SHIFT key while you are moving. 10 help_taskmanager_1 To create things in Darwinia you draw gestures in the Task Manager. Hold down [ALT] to access the Task Manager. 11 help_taskmanager_2 To see a list of available gestures, hold [ALT] to access the Task Manager and scroll left by moving the mouse to the left of the screen, or by pressing [KEYLEFT]. 12 help_taskmanager_3 You can only run up to THREE tasks at once. You can shut down existing tasks by holding down [ALT], tabbing along to the task, and pressing CTRL-C. 13 help_taskmanager_4 To reselect an existing task, hold down [ALT] to access the Task Manager and tab along to the icon representing the task. 14 help_showchatlog To read a log of everything I ve said, hold down the [KEYCHATLOG] key. 15 help_taskmanager_1_icons To create things in Darwinia you need to bring up the Task Manager. Hold down [KEYICONSTASKMANAGERDISPLAY] to access the Task Manager. 16 help_taskmanager_2_icons You can see a list of available programs while holding [KEYICONSTASKMANAGERDISPLAY]. Click any of them to create a new program. 17 help_taskmanager_3_icons You can only run up to THREE tasks at once. You can shut down the current task by pressing [KEYICONSTASKMANAGERENDTASK], or you can click on its delete icon in the Task Manager. 18 help_taskmanager_4_icons To reselect an existing task, hold down [KEYICONSTASKMANAGERDISPLAY] and click on its icon. Or you can press the number keys to select tasks. 19 help_showchatlog_icons To read a log of everything I ve said, hold down the [KEYICONSCHATLOG] key. 20 21 help_deselect To deselect the current object press [KEYDESELECT] 22 help_squad_summon_1 To create a Squad, hold [ALT] to access the Task Manager, then draw this gesture. 23 help_squad_summon_1_icons To create a Squad, hold [KEYICONSTASKMANAGERDISPLAY] to access the Task Manager, then click the Squad icon. 24 help_squad_summon_2 [LEFTCLICK] in one of the starting areas, now highlighted, to create your squad within the world. 25 help_squad_use [LEFTCLICK] to move your squad. Right Click to fire their lasers. Press [KEYDESELECT] to deselect them. 26 help_squad_use_1mb Click to move your squad. Click and hold to fire their lasers. Press [KEYDESELECT] to deselect them. 27 help_squad_grenade You can throw a grenade by tapping the [LEFTMOUSEBUTTON] whilst you are firing lasers with the Right mouse button. 28 help_squad_grenade_1mb You can throw a grenade by shift clicking. 29 help_squad_setgrenade To change to the Grenade weapon, draw the Grenade gesture. 30 help_squad_setrocket To change to the Rocket weapon, draw the Rocket gesture. 31 help_squad_setairstrike To change to the Airstrike weapon, draw the Airstrike gesture. 32 help_squad_setgrenade_icons To change to the Grenade weapon, hold down [KEYICONSTASKMANAGERDISPLAY] and click on the Grenade icon next to your Squad. 33 help_squad_setrocket_icons To change to the Rocket weapon, hold down [KEYICONSTASKMANAGERDISPLAY] and click on the Rocket icon next to your Squad. 34 help_squad_setairstrike_icons To change to the Airstrike weapon, hold down [KEYICONSTASKMANAGERDISPLAY] and click on the Airstrike icon next to your Squad. 35 36 help_building_reprogram This building must be reprogrammed before it can be used. To do this you must create an Engineer and move him within range of the nearby Control Tower. 37 help_engineer_summon Engineers are used to collect dead spirits, and to reprogram buildings. Hold [ALT] and draw this gesture to summon an Engineer. 38 help_engineer_summon_icons Engineers are used to collect dead spirits, and to reprogram buildings. Hold [KEYICONSTASKMANAGERDISPLAY] and click the Engineer icon to summon an Engineer. 39 help_engineer_summon_2 [LEFTCLICK] in one of the starting areas, now highlighted, to create your Engineer. Or press CTRL-C if you wish to terminate the Engineer program. 40 help_engineer_summon_2_icons [LEFTCLICK] in one of the starting areas, now highlighted, to create your Engineer. Or press [KEYICONSTASKMANAGERENDTASK] if you wish to terminate the Engineer program. 41 help_engineer_use Engineers will automatically do anything nearby that needs doing, such as collecting dead spirits or reprogramming buildings. Just [LEFTCLICK] to move them near a task. 42 43 help_officer_create You can use ordinary Darwinians to order other Darwinians around, by promoting them to officers. Draw this gesture for Officer and [LEFTCLICK] on a Darwinian. 44 help_officer_create_icons You can use ordinary Darwinians to order other Darwinians around, by promoting them to officers. Bring up the Task Manager and click the Officer icon, then click on a Darwinian. 45 help_officer_create_2 Click on a Darwinian to promote him to an Officer. Or press CTRL-C to terminate the Officer program. 46 help_officer_create_2_icons Click on a Darwinian to promote him to an Officer. Or press C to terminate the Officer program. 47 help_officer_use You can move an officer by [LEFTCLICKING]. Right click on the landscape to set GOTO Orders for other Darwinians to follow. Right click near the Officer to cancel his orders. 48 help_officer_use_1mb You can move an officer by clicking. Click and hold on the landscape to set GOTO Orders for other Darwinians to follow. Click and hold near the Officer to cancel his orders. 49 help_officer_toggle To toggle through all available orders, Right Click near the officer. 50 help_officer_toggle_1mb To toggle through all available orders, Click and hold near the officer. 51 52 help_showobjectives To see a list of objectives, hold [ALT] to access the Task Manager, then scroll right by moving the mouse to the right of the screen, or by pressing [KEYRIGHT]. 53 help_showobjectives_icons To see a list of objectives, hold [KEYICONSTASKMANAGERDISPLAY] to access the Task Manager, then scroll down by moving the mouse to the bottom of the screen, or by pressing [KEYBACKWARDS]. 54 help_armour_summon [LEFTCLICK] in one of the starting areas, now Highlighted, to create your Armour. Armour can only be created near Trunk Ports that you control. 55 help_armour_use [LEFTCLICK] to move your Armour. [RIGHTCLICK] near the armour to toggle loading and unloading of Darwinians. [RIGHTCLICK] on the landscape to deploy your Armour as a Battle Cannon. 56 help_armour_use_1mb [LEFTCLICK] to move your Armour. Click and hold the mouse button near the armour to toggle loading and unloading of Darwinians. Click and hold the mouse button on the landscape to deploy your Armour as a Battle Cannon. 57 58 help_radardish_1 This Radar Dish can be used to beam people to other Radar Dishes. Click on it to control it. 59 help_radardish_2 To aim the Radar Dish simply point and [LEFTCLICK] on the Radar Dish you wish to travel to. The receiving Radar Dish must be facing you. Press [KEYDESELECT] to deselect the Radar Dish. 60 help_incubator This building is an Incubator. You can use Engineers to carry spirits here, which will then be rebirthed into more Darwinians. 61 help_trunkport This is a Trunk Port. It acts as a stargate, connecting different locations within Darwinia together. 62 help_refinery This is the main Refinery. It powers the entire mining rig on these islands. To bring it online you will need to safely escort some Darwinians up here. 63 help_mine This building is a Mine. It will extract raw polygons from the hillside and dump them into the carts passing through. It needs several Darwinians to operate. 64 help_anthill Euurgh, disgusting! This area is infested with Ants! This appears to be one of their nests. A few well placed grenades should do the trick. 65 help_controltower This is a Control Tower. Send one of your engineers to reprogram it, and you ll be able to make use of the building it s connected to. 66 help_researchitem You ve found some of my research! Excellent. Create some Engineers nearby and they will download the research into my system. Hopefully it will be something useful. 67 help_gunturret_1 This Battle Cannon needs Darwinians operating it before it can be used. They will automatically shoot at any nearby enemies. Alternatively you can click on it to control it yourself. 68 help_gunturret_2 This Battle Cannon will track your cursor. Right Click to fire. Press [KEYDESELECT] to deselect. 69 help_gunturret_2_1mb This Battle Cannon will track your cursor. Click and hold to fire. Press [KEYDESELECT] to deselect.
https://w.atwiki.jp/git_jp/pages/33.html
usage repo COMMAND [ARGS] The complete list of recognized repo commands are init カレントディレクトリ内で repo を初期化 Initialize repo in the current directory sync 作業ツリーを最新のリビジョンに更新 Update working tree to the latest revision smartsync 作業ツリーを最新の安定バージョンに更新 Update working tree to the latest known good revision start トピックブランチを作成 Start a new branch for development abandon トピックブランチを削除 Permanently abandon a development branch prune マージ済みのトピックスブランチを破棄 Prune (delete) already merged topics branch トピックブランチの一覧を表示 View current topic branches checkout トピックブランチをチェックアウト Checkout a branch for development cherry-pick 変更をチェリーピック Cherry-pick a change. rebase ローカルブランチを上流のブランチにリベース Rebase local branches on upstream branch status 作業ツリーの状態を表示 Show the working tree status diff コミットと作業ツリー間の差分を表示 Show changes between commit and working tree stage ファイルをコミット予約する(ステージング) Stage file(s) for commit grep 条件に一致する行を出力 Print lines matching a pattern forall 全プロジェクトにシェルコマンドを実行 Run a shell command in each project list プロジェクト名とそのディレクトリを一覧表示 List projects and their associated directories manifest マニフェストを管理するユーティリティ Manifest inspection utility upload Gerritサーバに変更を登録 Upload changes for code review download Gerritサーバに登録された変更をダウンロード&チェックアウト Download and checkout a change version repoのバージョンを表示 Display the version of repo help コマンドの詳細なヘルプを表示 Display detailed help on a command selfupdate repo を最新のバージョンに更新 Update repo to the latest version See repo help command for more information on a specific command.
https://w.atwiki.jp/myscripts/pages/25.html
[iOS]神ツールを作るための神アプリ、MyScriptsがかなり便利 | ひとりぶろぐ http //hitoriblog.com/?p=5612 @hitoriblog さんによるアプリ紹介 [iOS]第1回 JavaScript実行開発環境MyScriptsの魅力を全力で伝えてみる | ひとりぶろぐ http //hitoriblog.com/?p=5676 @hitoriblog さんによるアプリ紹介 IAMASのGeekLabでMyScriptsのことを話してきました | ひとりぶろぐ http //hitoriblog.com/?p=6848 @hitoriblog さんによる詳しいプレゼン資料が掲載されています Teachme バックグラウンド監視 通知センターからの起動 スクリプトをSpotlightから検索する方法 MyScripts@WIKI内 スクリプトの起動方法 デフォルトスクリプトの使い方 4つのアクション
https://w.atwiki.jp/isiremaserver/pages/12.html
わからないことがあったら下のフォームにわからないことを打ち込んで送ってください。 ※対応が遅れる場合があります 質問する前にその質問がされてないか下のフォームで検索してなかったり、解決してない場合は送ってください。 検索フォーム Help検索 and or 質問する コメログ マインクラフトID 質問文 すべてのコメントを見る
https://w.atwiki.jp/kmshzr/pages/39.html
衣食住のこと ネット・情報機器関連 ボーカロイド
https://w.atwiki.jp/erp_bangkok/pages/15.html
エバーノート活用目的の価値観というか… どこでも登録・参照できるDBを持つ。 DBに何を入れるかは自由 DBをどう整理するかが大事だと思う。 活用目的 どこでも参照できるDB(データ)
https://w.atwiki.jp/note4recurrent/pages/22.html
尾崎先生 今日の説明資料は共有フォルダにあります。 s1共有\ozaki\Web基礎.pdf 6/21 HTTPの仕組み PC(http request URL) - サーバー(Apache) サーバー(http response) - PC ブラウザはURLを発行し、帰ってきたhtmlを画像に表示する役割。 静的ウェブページ お仕着せの完成品を買ってくるだけ 動的ウェブページ サーバーで情報と付け加えて返す:「JSPとサーブレット」 オーダーした完成品が届く点では静的コンテンツと一緒 Javascriptによる動的ページ:ブラウザで実行されるところがJSPとの違い 素材を返してもらって、最終的にはブラウザで加工して完成させる。 受け取ったコンテンツをブラウザ上で自動的に更新することができる(動く時計など) VSC起動 ファイルメニューでルートフォルダ選択(事前に作っておく) index.htmlを新規作成 最初の行にhtmlと入れるとショートカットが出るのでhtml 5を選ぶ。 決まり切ったコードが自動的に入れられる。(別に自分で叩いても、コピペしても無問題) lang = "ja" にしておくこと:この講座では日本語のページを作るから。 VSCの機能拡張 open in default browserをインストール javascriptの場所 /body の前に置くのが多い script src="script.js" /script は別のファイルを作るため script" 直接スクリプトを書くため /script 変数の作り方 var 使わないほうが良い(過去はこれしかなかった) const 再代入不可 let 再代入可能 Javascript は行末に;はあってもなくてもかまわない。あってもエラーにはならない。 ESLintという文法チェッカーではつけることを推奨:ほかの言語も書くときに忘れないようにつけたほうがいいかも。 変数の宣言 静的型付(C JAVA COBOL VBA)メモリが少なかった時代に開発されたもの。メモリを節約させるため。 動的型付(PHP Javascript Python)メモリが豊富に使えるようになってから作られた言語に多い let lang = "ジャバスクリプト" lang = "Java" lang = 100 //許される Javascript で使える変数の型 Number:数値 整数も少数も大きな数字もこれだけ NaN(Not a Number 非数字) String:文字列全て Boolean Null Undefined type ofで変数に入っているデータの型を調べられる a=4 console.log(typeof a) *num console.log(typeof "a") String let lang = "ジャバスクリプト" lang = "Java" lang = 100 //許される console.log(lang) //Javascript データ型 // Number console.log(0/0) const a = 10 const b = 4 console.log(a+b) console.log(a-b) console.log(a*b) console.log(a/b) console.log(a % b) //剰余算 console.log(a ** b) //べき乗 console.log(typeof num) //型を調べる // String "" も const food1 = "チョコレート" const food2 = チョコレート console.log(food1) const food3 = "パフェ" console.log(food1+food3) // + で連結 //+で連結された結果は文字列となる const drink1 = "珈琲" const unit = "杯" console.log(drink1 + 3 + unit) console.log(typeof (drink1 + 3 + unit)) //テンプレートリテラル(ES6) //例 「珈琲を2杯ください」 console.log(drink1 + "を" + 2 + unit + "ください") console.log(`${drink1}を2${unit}ください`) //"15"を15に変換(VBAのVALUE) const strNum = "15" console.log(typeof parseInt(strNum))//parseIntで文字列が数字になる //数字として認識できるかどうかはシステムに依存。全角の数字でもいけるかどうか保証できない。 // Undefined(未定義) // 初期化されていない変数 // Boolean(真偽値) // true or false だけを持てる let flg = true console.log(flg) //否定演算子 ! console.log(!flg) //比較演算子 const con1 = 100 const con2 = 50 //等値演算子 console.log(con1 == con2*2)//左辺と右辺が等しい値か console.log(con1 != con2*2)//左辺と右辺は等しい値ではないか //同値演算子 const con3 = "50" console.log(con2 == con3) //左辺と右辺が等しい値か console.log(con2 === con3)//左辺と右辺が同じ値か:型まで一致しているか //配列 const drinks = ["珈琲","紅茶","ジュース","緑茶"] console.log(drinks[0]) console.log(drinks[2]) drinks[2] = "apple" //const で宣言したものでも更新できる console.log(drinks[2]) !DOCTYPE html html lang="ja" head meta charset="UTF-8" meta http-equiv="X-UA-Compatible" content="IE=edge" meta name="viewport" content="width=device-width, initial-scale=1.0" title Event /title /head body h1 id="target" アクセス前 /h1 button id="clk" click /button h2 id="target2" ABC /h2 p 下のボタンをクリックすると上の文字が変わります /p button id="clk2" change! /button script //読み込み完了時に動作 window.addEventListener("DOMContentLoaded",function(){ const newH1 = "アクセス後" const idTarget = document.querySelector("#target") //console.log(idTarget) idTarget.innerHTML = newH1 //ボタンを捕まえる const clickButton = document.querySelector("#clk") //console.log(clickButton) let flag = true clickButton.addEventListener("click",function(){ if (flag){ idTarget.innerHTML = "Clickされたよ" } else{ idTarget.innerHTML = newH1 } flag = !flag }) //ボタン2を捕まえる const clickButton2 = document.querySelector("#clk2") const idTarget2 = document.querySelector("#target2") let flag2 = true clickButton2.addEventListener("click",function(){ if (flag2){ idTarget2.innerHTML = "CDE" } else{ idTarget2.innerHTML = "ABC" } flag2 = !flag2 }) }) /script /body /html ボタン2を捕まえる以下のみ色々試した。 //ボタン2を捕まえる const clickButton2 = document.querySelector("#clk2") const idTarget2 = document.querySelector("#target2") let flag2 = 0 clickButton2.addEventListener("click",function(){ if(flag2 == 0){ idTarget2.innerHTML = "DEF" } else if(flag2 == 1){ idTarget2.innerHTML = "GHI" } else { idTarget2.innerHTML = "ABC" } flag2 += 1 if(flag2 2){ flag2 = 0 } if (idTarget2.innerHTML == "DEF"){ idTarget2.innerHTML = "文字列によって反応を変えることもできる" } }) 後、乱数発生の関数を加えれば簡易じゃんけんゲームくらいはできそう。 配列を使って順番にテキストを回す let i = 0; let dispText = ["DEF","GHI","ABC"] //この行までは起動時に一回だけ実行される。 clickButton2.addEventListener("click",function(){ //button2 が押される度に下のブロックが実行される。変数の値は残っている。 idTarget2.innerHTML = dispText[i]; i += 1; if (i 2){ i = 0; } }) 乱数と切り捨て関数を使ってランダムに表示 連続しないように確認を追加 const clickButton2 = document.querySelector("#clk2") const idTarget2 = document.querySelector("#target2") let ransuu = 0; let check = 0; let dispText = ["Masth.random と Math.trunc","乱数と整数切り捨て関数","コードスッキリ","配列の使い方の練習にもなった"] clickButton2.addEventListener("click",function(){ if (ransuu == check){ ransuu = Math.trunc(Math.random()*10/3); //乱数は0〜1の少数なので10倍して3で除した結果の少数以下を切り捨てている } else { ransuu = check; } idTarget2.innerHTML = dispText[ransuu]; }) 関数を使ってみました コードがスッキリして読みやすい(はずw) const clickButton2 = document.querySelector("#clk2") const idTarget2 = document.querySelector("#target2") let ransuu = 0; let dispText = ["Masth.random と Math.trunc","乱数と整数切り捨て関数","コードスッキリ","配列の使い方の練習にもなった"] clickButton2.addEventListener("click",function(){ ransuu = getRansuu(ransuu); idTarget2.innerHTML = dispText[ransuu]; }) //今持ってる数字ransuuを受けて異なる数字を返す関数 karisuu は関数内でしか使わないローカル変数 function getRansuu(num) { let karisuu = Math.trunc(Math.random()*10/3); //乱数は0〜1の少数なので10倍して3で除した結果の少数以下を切り捨てている while (num == karisuu) { //メインの数字が持っているものと同じ数字が出ている間は何回も数字を取得する karisuu = Math.trunc(Math.random()*10/3); } return karisuu; }; 繰り返し:ループ for forEach script window.addEventListener("DOMContentLoaded",function(){ //Get UL const ulCourses = document.querySelector("#courses") const subjects =[ "webクリエイター", "web プログラマー", "動画編集", ] for (let index = 0 ; index subjects.length ; index++){ //meke li tag li /l const newLi = document.createElement("li") // li にテキストを入れる li web creater /li newLi.innerText = subjects[index] // add ulCourses.appendChild(newLi) } subjects.forEach(function(subject){ const newLi = document.createElement("li") newLi.innerText = subject ulCourses.appendChild(newLi) }) }) /script html !DOCTYPE html html lang="ja" head meta charset="UTF-8" meta name="viewport" content="width=device-width, initial-scale=1.0" title Memoアプリ /title link href="https //cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous" /head body div class="container" !-- INPUT -- div class="alert alert-secondary mt-3" div class="row" div class="col-3" input type="text" class="form-control" name="" id="name" placeholder="名前" /div div class="col-7" input type="text" class="form-control" name="" id="comment" placeholder="コメント" /div div class="col-2" button class="btn btn-outline-success" id="btn" 追加 /button /div /div /div !-- DATA TABLE -- table class="table table-secondary table-striped table-bordered" id="tbl" tr th 名前 /th th コメント /th th 日付 /th /tr tr td 森下 /td td ........ /td td 2022/06/27 /td /tr tr td 森下 /td td ........ /td td 2022/06/27 /td /tr /table /div script src="memoapp.js" /script /body /html memoapp.js //windwoが読みこまれるまで待機 window.addEventListener("DOMContentLoaded",function(){ const tbl = this.document.querySelector("#tbl") //btnが押されたら const btn = document.querySelector("#btn") btn.addEventListener("click",function(){ //名前を取り込む const name = document.querySelector("#name") //コメントを読みこむ const comment = document.querySelector("#comment") //名前とコメントの両方に入力があった場合 //name.length に文字数が入ってくる //if (name.value.length 0 comment.value.length 0){ も同じ意味 if (name.value.length comment.value.length ){ //入力された日時の取得 月は0オリジンなので注意が必要 const current = new Date() const currentStr= `${current.getFullYear()}年${current.getMonth()+1}月${current.getDate()}日` //console.log(currentStr) //tableの更新 //tr行設定 const trTag = document.createElement("tr") //td 1行あたり3カラム(3列)なので、tdを3回繰り返す。 const tdNameTag = document.createElement("td") //一つ目のtd tdNameTag.innerText = name.value //tdの中身を設定 name.value には上で入力された名前が入っている trTag.appendChild(tdNameTag) //tdタグを加える1回目 const tdCommentTag = document.createElement("td") tdCommentTag.innerText = comment.value trTag.appendChild(tdCommentTag) //tdタグを加える2回目 const tdDateTag = document.createElement("td") tdDateTag.innerText = currentStr trTag.appendChild(tdDateTag) //tdタグを加える一3回目 //tableにtr行を挿入 tbl.appendChild(trTag) //三つのtdの入ったtrを一行追加 //入力フィールドをクリアして終わり name.value ="" comment.value ="" } }) }) 2022/7/05 !doctype html html lang="ja" head meta charset="utf-8" meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" link href="https //cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous" title Javascript game /title /head body div class="container" div class="alert alert-info" h1 class="h4" 足りない文字はどれ? /h1 button class="btn btn-info" id="makeQuestion" 出題 /button span id= timediff class="px-3" /span /div div class="row" id="quizDiv" /div //数字を並べる場所 div class="form-row" div class="col-2 offset-9" //col-2 offset-9 はbootstrap で使うためのセレクタ 以下同様 答え input type="text" name="" id="answerBox" class="form-control" //回答記入用フィールドの設定 /div div class="col-1" button class="btn btn-danger" id="answerbtn" 回答 /button //回答ボタンを配置 /div /div /div script window.addEventListener("DOMContentLoaded",function(){ // console.log("load"); // 問題を書き込む場所 const quizDiv = document.querySelector("#quizDiv"); //問題文字列を並べる場所を使う //quizDiv に quizDiv で設定した場所(div id ="quizDiv" で指定されたところ)を入れる //console.log(quizDiv); // 解答入力欄 const answerBox = document.querySelector("#answerBox"); //入力欄を今後 answerBox として使う //console.log(answerBox); let condition = false; //出題が押されているかどうかの確認に使う let answer = ""; //答えを保管するための変数 const makeQuestion = document.querySelector("#makeQuestion"); //出題ボタンを使うという宣言 //出題ボタンをクリックされたときの動作 makeQuestion.addEventListener("click",function(){ condition = true; //出題済にする const questions = ["A","B","C","D","E"]; //問題の配列を設定 // console.log("btn clicked"); //quesiton から1つ取り出す answer = questions.splice(Math.floor(Math.random()*questions.length),1); //randomを使って一文字を抜き取る Mathfloor は切り捨て、Math.randomは乱数発生 //Math.random()にquestions.lengthを掛けることで最大いくつまでの乱数を発生させるかを操作する //Math.random()は0〜1までの少数なので4を掛ければ0〜3までの少数になる。Mathfloorで切り捨てて整数にしている。 //Math.random()にquestions.lengthを掛けているのはquestionsの数が変わってもプログラムを書き直す必要がないようにするため。(他のプログラムにコピペして再利用するときにも便利) // console.log(questions.splice(Math.floor(Math.random()*questions.length),1)); //console.log(Math.floor(Math.random()*questions.length)); //console.log(answer); //console.log(questions); //前回の結果をクリア while(quizDiv.firstChild){ //quizDiv.firstChild がある間は回り続ける quizDiv.removeChild(quizDiv.firstChild); //quizDivにある子要素(この場合div)を上から一つ取り除く } //文字列を並べかえる、 const questions2 = []; //並べ替えのための配列を準備 while(questions.length){ //questions の配列分ループする questions2.push(questions.splice(Math.floor(Math.random()*questions.length),1)[0]); //splice で切り取るための開始位置をランダムで決めている。 //random の乗数をquestions.lengthとしているのはquestionsの配列がループを回る度に変わるから。 //quetions.splice(開始位置,抜き取る数) //questions2.push(配列に付け加える対象) //一番右に[0]とあるのは、splice で抜き取ったものが配列だから。ここでは1個しかないのでゼロ番目と決まっている。 } questions.push(...questions2); // 配列の中身を他の配列にコピーするチート技。新しいJavascriptでしかできない。 //これを使わない場合はループを使って中身を一つ一つコピーするしかない。 //文字列を並べる divタグを追加 questions.forEach (function(q){ //questions の数だけ以下のブロックを実行。qにはquestions配列から取り出した文字一つが入っている。 //console.log(q); const newDiv = document.createElement("div"); //div タグを生成 if (Math.floor(Math.random()*2)===0){ //ランダムで0か1かを発生し、0なら以下を実行 q = q.toLowerCase(); // qを小文字に変換(else を使わないのは元々大文字が入っているから } newDiv.innerText = q; //q をdiv の innerText に入れる(htmlで表示される) newDiv.classList.add("col-1","border","text-center","me-1"); //div に付加するclassを一括設定 //col-1 は CSS(この場合はbootstrapやけど)で横に並べる設定。 //border は枠線をつける、text-center は中央揃え、me-1 は右にマージン1 quizDiv.append(newDiv); // newDiv を quizDiv に追加 //ループ一回転で一つの文字 div /div を追加する }) }); //解答ボタンをクリックされたときの動作 const answerbtn = document.querySelector("#answerbtn"); answerbtn.addEventListener("click",function(){// console.log("ansbtn clicked"); // if (condition == false){ // console.log("出題されていない"); // return false; // } const inputAnswer = answerBox.value.toUpperCase(); //inputAnswer に入力された文字を大文字にして代入 if(condition inputAnswer.length===1){ //condition(出題ボタンが押されていて)inputAnswerが一文字(空白だったり2文字以上だったりしないときに以下のブロックを実行 if (answer[0] === inputAnswer){ //出題時にとっておいた answer と inputAnswer と突合 alert("正解です"); }else { alert("不正解です"); answerBox.value =""; //不正解の場合は入力欄をクリアして次の入力を待つ。 } } }); }); /script /body /html